.clearfix::after {
    content: "";
    display: block;
    clear: both;
}

.header {
    background-color: lightblue;
    height: 40px;
    line-height: 40px;
    color: #999;
    width: 100%;
    position: fixed;
}

.header .topnav>li {
    float: left;
    text-align: center;
    margin: 0 20px;
    width: 15%;
    box-sizing: border-box;
    background-color: red;
    height: 40px;
    position: relative;
}

.header .topnav>li:hover {
    background-color: #fff;
    border: 2px solid #ccc;
    border-bottom: none;
    line-height: 36px;
}

.header .topnav>li .subnav {
    width: 300px;
    text-align: left;
    line-height: 1.5;
    background-color: #fff;
    border: 2px solid #ccc;
    display: none;
    position: absolute;
    right: -2px;
}

.header .topnav>li .subnav ul li {
    float: left;
    width: 150px;
    box-sizing: border-box;
    text-align: center;
}

.header .topnav>li .subnav ul li:hover {
    background-color: yellow;
}

.header .topnav>li:hover .subnav {
    display: block;
}

.header .topnav>li:hover::after {
    content: "";
    position: absolute;
    background-color: #fff;
    height: 5px;
    width: 100%;
    right: 0;
    bottom: 0;
}